<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .hide {
        display: none;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <div class="accordion">
        <h3 @click="handle1">选项卡1</h3>
        <div :class="{hide:xuanxiangkayi}">1111</div>
        <h3 @click="handle2">选项卡2</h3>
        <div ref="xxx">222</div>
        <h3 @click="handle3">选项卡1</h3>
        <div :class="{hide:xuanxiangkayi3}">1111</div>
      </div>
    </div>
    <script src="../lib/vue.js"></script>
    <script>
      new Vue({
        el: '#app',
        data: {
          xuanxiangkayi: false,
          xuanxiangkayi3: false,
        },
        methods: {
          handle1: function () {
            this.xuanxiangkayi = !this.xuanxiangkayi
          },
          handle2: function () {
            let div = this.$refs.xxx
            div.classList.toggle('hide')
          },
          handle3: function () {
            this.xuanxiangkayi3 = !this.xuanxiangkayi3
          },
        },
      })
    </script>
  </body>
</html>
